<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>物料管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
            if(!${fns:getUseroffice() eq "总部"}){
                $("#project").attr("readonly",'true');
            }
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/infor/goods/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#dates').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
	        $('#limitedPeriod').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
	        $('#storageDate').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
	        $('#practicalDate').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="goods" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
		   <tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>所属货主：</label></td>
					<td class="width-35">
						<form:input path="project" htmlEscape="false"  class="form-control required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>物料名称：</label></td>
					<td class="width-35">
						<form:input path="name" htmlEscape="false"    class="form-control required"/>
					</td>
				</tr>
				<tr>

					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>物料编码：</label></td>
					<td class="width-35">
						<form:input path="code" htmlEscape="false"    class="form-control required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>物料类型：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/infor/materialType/data" id="type" name="type.id" value="${goods.type.id}" labelName="type.name" labelValue="${goods.type.name}"
										title="选择物料类型" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>
					</td>
				</tr>

				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>物料规格：</label></td>
					<td class="width-35">
						<form:input path="specifications" htmlEscape="false"    class="form-control required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>货主代码：</label></td>
					<td class="width-35">
						<form:input path="ownerCode" htmlEscape="false"    class="form-control required"/>
					</td>
				</tr>
				<tr>


					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>毛重（吨)：</label></td>
					<td class="width-35">
						<form:input path="grossWeight" htmlEscape="false"    class="form-control required isFloatGtZero"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>体积(M3）：</label></td>
					<td class="width-35">
						<form:input path="volume" htmlEscape="false"    class="form-control required isFloatGtZero"/>
					</td>
				</tr>

				<tr>
					<td class="width-15 active"><label class="pull-right">托盘可叠层数：</label></td>
					<td class="width-35">
						<form:input path="trayNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>价格调整比例：</label></td>
					<td class="width-35">
						<form:input path="money" htmlEscape="false"    class="form-control required"/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>每标准托盘可存放单品数量 ：</label></td>
					<td class="width-35">
						<form:input path="trayAmount" htmlEscape="false"    class="form-control required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>单品比例：</label></td>
					<td class="width-35">
						<form:input path="proportion" htmlEscape="false"    class="form-control required"/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>包装：</label></td>
					<td class="width-35">
						<form:input path="packingCode" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>单位：</label></td>
					<td class="width-35">
						<form:input path="packing" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">描述：</label></td>
					<td class="width-35">
						<form:input path="des" htmlEscape="false"    class="form-control "/>
					</td>

					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>净重(吨)：</label></td>
					<td class="width-35">
						<form:input path="weight" htmlEscape="false"    class="form-control required "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">长（M）：</label></td>
					<td class="width-35">
						<form:input path="length" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">宽（M) ：</label></td>
					<td class="width-35">
						<form:input path="width" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">高（M)：</label></td>
					<td class="width-35">
						<form:input path="height" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">装车可叠层数：</label></td>
					<td class="width-35">
						<form:input path="loadingNumber" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">每标准包装箱可存放单品数量 ：</label></td>
					<td class="width-35">
						<form:input path="boxAmount" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">颜色：</label></td>
					<td class="width-35">
						<form:input path="colour" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">保质期类型：</label></td>
					<td class="width-35">
						<form:input path="shelf_type" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">危险品代码：</label></td>
					<td class="width-35">
						<form:input path="dangerousCode" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">入库保质期天数：</label></td>
					<td class="width-35">
						<form:input path="entryShelf" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">海关代码：</label></td>
					<td class="width-35">
						<form:input path="customsCode" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">出库保质期天数：</label></td>
					<td class="width-35">
						<form:input path="libraryShelf" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">装箱组：</label></td>
					<td class="width-35">
						<form:input path="packingGroup" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">原产国：</label></td>
					<td class="width-35">
						<form:input path="originCountry" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">保质期天数：</label></td>
					<td class="width-35">
						<form:input path="shelf" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">批次模板：</label></td>
					<td class="width-35">
						<form:input path="batchTemplate" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">价目表：</label></td>
					<td class="width-35">
						<form:input path="priceList" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">海关项号：</label></td>
					<td class="width-35">
						<form:input path="customsNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">保质期控制：</label></td>
					<td class="width-35">
						<form:input path="shelfControl" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">尺码：</label></td>
					<td class="width-35">
						<form:input path="size" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">型号：</label></td>
					<td class="width-35">
						<form:input path="model" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">成本价格：</label></td>
					<td class="width-35">
						<form:input path="costPrice" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">销售价格：</label></td>
					<td class="width-35">
						<form:input path="salesPrice" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">净价：</label></td>
					<td class="width-35">
						<form:input path="netPrice" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">承重商品：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isBearing" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">是否禁止订货：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isProhibit" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
					<td class="width-15 active"><label class="pull-right">促销品：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isPromotion" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">组装件：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isAssemble" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
					<td class="width-15 active"><label class="pull-right">启用：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isUse" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">是否禁止空运：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isAir" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
					<td class="width-15 active"><label class="pull-right">是否单件扫描：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isSingle" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">是否大件商品：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isLarge" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
					<td class="width-15 active"><label class="pull-right">是否序列号：</label></td>
					<td class="width-35">
						<form:radiobuttons path="isSerial" items="${fns:getDictList('material')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货品组：</label></td>
					<td class="width-35">
						<form:input path="goodsGroup" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">货品组2：</label></td>
					<td class="width-35">
						<form:input path="goodsGroupTwo" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货品组3：</label></td>
					<td class="width-35">
						<form:input path="goodsGroupThree" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">货品组4：</label></td>
					<td class="width-35">
						<form:input path="goodsGroupFour" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">运输方式 ：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/infor/transport/data" id="transport" name="transport.id" value="${goods.transport.id}" labelName="transport.mode" labelValue="${goods.transport.mode}"
							 title="选择运输方式 " cssClass="form-control " fieldLabels="名称" fieldKeys="mode" searchLabels="名称" searchKeys="mode" ></sys:gridselect>
					</td>
					<td class="width-15 active"><label class="pull-right">存储温度：</label></td>
					<td class="width-35">
						<form:input path="storageTemp" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">运输温度：</label></td>
					<td class="width-35">
						<form:input path="tmsTemp" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">接收温度：</label></td>
					<td class="width-35">
						<form:input path="receiveTemp" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">序列号长度：</label></td>
					<td class="width-35">
						<form:input path="serialLength" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">最小订单量：</label></td>
					<td class="width-35">
						<form:input path="smallOrder" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">订货提前期：</label></td>
					<td class="width-35">
						<form:input path="orderAdvance" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">提货单号：</label></td>
					<td class="width-35">
						<form:input path="goodsNumber" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">预期量：</label></td>
					<td class="width-35">
						<form:input path="expectNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">提货仓库：</label></td>
					<td class="width-35">
						<form:input path="goodsWarehouse" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">生产日期：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='dates'>
			                    <input type='text'  name="dates" class="form-control"  value="<fmt:formatDate value="${goods.dates}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
					<td class="width-15 active"><label class="pull-right">已派车量：</label></td>
					<td class="width-35">
						<form:input path="vehicleDispatching" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">有效期至：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='limitedPeriod'>
			                    <input type='text'  name="limitedPeriod" class="form-control"  value="<fmt:formatDate value="${goods.limitedPeriod}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
					<td class="width-15 active"><label class="pull-right">派车量：</label></td>
					<td class="width-35">
						<form:input path="assignVehicle" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">接收量：</label></td>
					<td class="width-35">
						<form:input path="receptionAmount" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">状态：</label></td>
					<td class="width-35">
						<form:input path="status" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">入库日期：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='storageDate'>
			                    <input type='text'  name="storageDate" class="form-control"  value="<fmt:formatDate value="${goods.storageDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
					<td class="width-15 active"><label class="pull-right">批次：</label></td>
					<td class="width-35">
						<form:input path="batch" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货品描述：</label></td>
					<td class="width-35">
						<form:input path="goodsDescribe" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">货品代码：</label></td>
					<td class="width-35">
						<form:input path="goodsCode" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">原订购量：</label></td>
					<td class="width-35">
						<form:input path="originalOrder" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">箱号：</label></td>
					<td class="width-35">
						<form:input path="caseNumber" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">预分配量：</label></td>
					<td class="width-35">
						<form:input path="predistribution" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">订货数量：</label></td>
					<td class="width-35">
						<form:input path="orderGoods" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">拣货数量：</label></td>
					<td class="width-35">
						<form:input path="orderPicking" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">单价：</label></td>
					<td class="width-35">
						<form:input path="price" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">分配数量：</label></td>
					<td class="width-35">
						<form:input path="quantityAllotted" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">发货数量：</label></td>
					<td class="width-35">
						<form:input path="shipmentsNumber" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">允许替代：</label></td>
					<td class="width-35">
						<form:input path="allowReplace" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">每标准储位可存放单品数量：</label></td>
					<td class="width-35">
						<form:input path="locationAmount" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">原行号：</label></td>
					<td class="width-35">
						<form:input path="originalNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">替代料：</label></td>
					<td class="width-35">
						<form:input path="replaceMaterial" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">外部批号：</label></td>
					<td class="width-35">
						<form:input path="externalNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">原物料编码：</label></td>
					<td class="width-35">
						<form:input path="originalMaterial" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">批次属性：</label></td>
					<td class="width-35">
						<form:input path="batchProperty" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">供应商代码：</label></td>
					<td class="width-35">
						<form:input path="supplierCode" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货品型号：</label></td>
					<td class="width-35">
						<form:input path="productType" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">实际发货日期：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='practicalDate'>
			                    <input type='text'  name="practicalDate" class="form-control"  value="<fmt:formatDate value="${goods.practicalDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">装车量：</label></td>
					<td class="width-35">
						<form:input path="truckLoading" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">供应商名称：</label></td>
					<td class="width-35">
						<form:input path="supplierName" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">计划量：</label></td>
					<td class="width-35">
						<form:input path="planAmount" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
					<td class="width-35">
						<form:input path="remarks" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>